
***********************************************************************.
* PATCHFILE FOR CORRECTING ERRATA IN ALLBUS/GGSS 1988                 *.
*                                                                     *.
*                                                                     *.
* FOR USE WITH RELEASE 1.0.0,  doi:10.4232/1.1670 	                  *.
*                                                                     *.
* THIS PATCH CORRECTS WEIGHT VARIABLE v603 AND RECODES                *.
* CASES LACKING INFORMATION TO MISSING                                *.
*                                                                     *.
* ALSO,THIS PATCH RECODES MISSING VALUE CODES TO INTEGERS             *.
* FOR VARIABLES WITH DECIMAL PLACES AND ASSIGNS LABELS TO THEM		  *.              
*             							                              *.                                                        								      *.
***********************************************************************.

use "$widowsallbus/data/ZA1670_v1-0-0.dta", clear
notes drop _all

*	v603, TRANSFORMATIONSGEWICHT 
* 	DATA CORRECTION: RECODING CASES LACKING INFORMATION TO MISSING (.a "KEINE ANGABE")


recode v603 (99.99999 = .a)
capture label define Gewichte .a "KEINE ANGABE"
label values v603 Gewichte
foreach var in v603{
note `var' : TS CASES LACKING INFORMATION ABOUT HOUSEHOLD SIZE WERE SET TO MISSING
}

*RECODING VARIABLES AND ASSIGNING LABELS TO MISSING VALUES FOR VARIABLES WITH DECIMAL PLACES


foreach var in v176 v254 v325{
replace `var' = 998 if `var' == 99.8
replace `var' = 999 if `var' == 99.9
notes `var': TS CODES FOR MISSING VALUES DIFFER FROM SPSS DATA SET
}


foreach var in v176 v254 {
capture label define `var' 99 "99 STUNDEN ODER MEHR", replace
label values `var' `var'
}


foreach var in v176 v254 v325{
capture label define `var' 0 "TNZ", modify
capture label define `var' 999 "KEINE ANGABE", modify
capture label define `var' 998 "WEISS NICHT", modify
label values `var' `var'
}


foreach var in v325 {
capture label define `var' 80 "80 STUNDEN ODER MEHR", add
label values `var' `var'
}

foreach var in v172 v188 v244 v251 v315 v396{
replace `var' = 998 if `var' == 999.8
replace `var' = 999 if `var' == 999.9
notes `var': TS CODES FOR MISSING VALUES DIFFER FROM SPSS DATA SET
}


foreach var in v172 v188 v244 v251 v315 v396{
capture label define `var' 998 "WEISS NICHT", modify
capture label define `var' 999 "KEINE ANGABE", modify
label values `var' `var'
}

foreach var in v322{
replace `var' = 999 if `var' == 999.9
notes `var': TS CODES FOR MISSING VALUES DIFFER FROM SPSS DATA SET
}


foreach var in v322{
capture label define `var' 999 "KEINE ANGABE", add
label values `var' `var'
}


foreach var in v288{
replace `var' = 996 if `var' == 999.6
replace `var' = 997 if `var' == 999.7
replace `var' = 998 if `var' == 999.8
replace `var' = 999 if `var' == 999.9
notes `var': TS CODES FOR MISSING VALUES DIFFER FROM SPSS DATA SET
}

foreach var in v288{
capture label define `var' 0 "TNZ", replace
capture label define `var' 999 "KEINE ANGABE", modify
capture label define `var' 996 "NIE BERUFSTAETIG", modify
capture label define `var' 997 "ANGABE VERWEIGERT", modify
capture label define `var' 998 "WEISS NICHT", modify
label values `var' `var'
}


note: TS CODES AND LABELS OF MISSING VALUES UPDATED FOR VARIABLES WITH DECIMAL PLACES: ///
PLEASE NOTE THAT FOR THESE VARIABLES THE STATA CODES MIGHT BE DIFFERENT FROM THOSE OF THE SPSS DATA SET

save "$widowsallbus/processed/ZA1670_v1-0-0_patched.dta", replace
